package com.gp.node.operator;

import com.gp.node.INode;
import com.stock.StockData;

// this class implement * operator
// functions description can be found at the interface IOperatorBinary 
public class Mul extends IOperatorBinary{

	private static final long serialVersionUID = 6846397318762811039L;

	@Override
	public double getValue(StockData stock) {
		return right.getValue(stock) * left.getValue(stock); 
	}

	@Override
	public INode createNew()  {
		 return new Mul();
	}
	
	@Override
	public INode copy() {
		Mul node = new Mul();
		node.setByCopy(this);
		return node;
	}
	
	@Override
	public String print(StockData stock) {
		return "(" + right.print(stock) + ") * (" + left.print(stock) + ")";
	}
	
	@Override
	public String print() {
		return "(" + right.print() + ") * (" + left.print() + ")";
	}

}
